<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

    <head th:include="include :: header"></head>

	<body class="gray-bg">
            <div class="wrapper wrapper-content animated fadeInRight">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>查看检测</h5>
                    </div>
                    <div class="ibox-content">
                        <form method="POST" action="/ttx/rootTrace/view/result" class="form-horizontal">

                            <div class="form-group">
                                <label class="col-sm-2 control-label">请输入批次：</label>
                                <div class="col-sm-10">
                                    <input class="form-control" type="text" name="batch"/>
                                </div>
                            </div>
                        	
                            <!--<div class="form-group">-->
                                <!--<label class="col-sm-2 control-label">请选择产品：</label>-->
                                <!--<div class="col-sm-10">-->
                                    <!--<select class="form-control m-b" id="item" name="id">-->

                                    <!--</select>-->

                                <!--</div>-->
                            <!--</div>-->


                            <div class="form-group">
                                <!--<div class="row">-->
                                    <label class="col-sm-2 control-label">请选择产品：</label>
                                    <div class="col-sm-10">
                                        <div class="input-group">
                                            <input type="text" name="productName" class="form-control" id="test_data">
                                            <div class="input-group-btn">
                                                <button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                </ul>
                                            </div>
                                            <!-- /btn-group -->
                                        </div>
                                    </div>
                                <!--</div>-->
                            </div>

                        	

                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit">提交</button>
                                    <!--<button class="btn btn-white" type="submit">取消</button>-->
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

            <div th:include="include::footer"></div>
    <script th:src="@{/js/plugins/suggest/bootstrap-suggest.min.js}"></script>
    <script type="text/javascript">
        var dataArray = [];
        var testdataBsSuggest = $("#test_data").bsSuggest({
//            indexId: 2, //data.value 的第几个数据，作为input输入框的内容
            keyField: 'productName', //data.value 的第几个数据，作为input输入框的内容
            getDataMethod: "url",
            effectiveFields:["productName"],
            effectiveFieldsAlias:{productName: "产品名称"},
            showHeader: true,
            autoSelect: true,
            url: getProjectName()+'/product/getProductListByName?productName=',
            processData: function(json){// url 获取数据时，对数据的处理，作为 getData 的回调函数
                var result = json.data;
                var i, len, data = {value: []};
                if(!result || result.length == 0) {
                    return false;
                }
                len = result.length;
                for (i = 0; i < len; i++) {
                    data.value.push({
                        "productName": result[i].productName,
                    });
                }
                return data;
            }
//            data: {
//                'value': [
//                    {
//                        //'id': '0',
//                        //'word': 'lzw',
//                        'description': 'http://lzw.me'
//                    },
//                    {
//                        //'id': '1',
//                        //'word': 'lzwme',
//                        'description': 'http://w.lzw.me'
//                    },
//                    {
//                        //'id': '2',
//                        // 'word': 'meizu',
//                        'description': 'http://www.meizu.com'
//                    },
//                    {
//                        //'id': '3',
//                        //'word': 'flyme',
//                        'description': 'http://flyme.meizu.com'
//                    }
//                ],
//                'defaults': 'http://lzw.me'
//            }
        });

        function getProductNameList(searchKey) {
            $.ajax({
                cache : true,
                type : "GET",
                url : getProjectName()+"/product/getProductList",
//                data : $('#signupForm').serialize(),// 你的formid
                async : false,
                error : function(request) {
                    parent.layer.alert("Connection error");
                },
                success : function(data) {
                    var itemList = data.data;
                    for (var i in itemList){
                        var item = {"description":itemList[i]};
                        dataArray.push(item);
                    }


                }
            });
        }
    </script>

	</body>

</html>